package com.yoso.shop.infrastructure.base.service;


import com.yoso.shop.infrastructure.base.entity.BaseEntity;
import com.yoso.shop.infrastructure.base.vo.BaseVo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shizejin
 * @date 2021/11/9
 * @description:
 */
public abstract class BaseService<E extends BaseEntity,V extends BaseVo,M extends BaseEntityExample> extends AbstractBaseService<E,M>{
    public abstract E V2E(V data);
    public abstract V E2V(E data);

    public List<E> bachV2E(List<V> vs){
        List<E> result = new ArrayList<>();
        vs.forEach(e->{
            result.add(V2E(e));
        });
        return result;
    }

    public List<V> bachE2V(List<E> es){
        List<V> result = new ArrayList<>();
        es.forEach(e->{
            result.add(E2V(e));
        });
        return result;
    }
}
